package com.itheima.day08.myTreeSet.test2$.entry;

import com.itheima.day08.myTreeSet.test2$.domain.Student;
import com.itheima.day08.myTreeSet.test2$.service.StudentService;

import java.util.Scanner;
import java.util.TreeSet;

public class InfoManagerEntry {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StudentService studentService = new StudentService();
        while (true) {
            System.out.println("添加学生.1  查看学生.2  退出.3");
            String str = sc.nextLine();
            str.trim();
            switch (str) {
                case "1":
                    boolean boo = studentService.addStudent();
                    if(boo == true){
                        System.out.println("添加成功\n");
                    }else{
                        System.out.println("添加失败\n");
                    }
                    break;
                case "2":
                    TreeSet<Student> treeSet = studentService.getStudent();
                    for (Student student : treeSet) {
                        System.out.println(student);
                    }
                    break;
                case "3":
                    System.out.println("欢迎使用");
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入有误\n");
                    break;
            }

        }


    }
}
